@use '../vars';
@use '../mixins';

/* Normalize File */
@use '../../../node_modules/normalize.scss/normalize';

/* Font definitions */
@use 'fonts';

@use 'forms';

/**
 * DDG Extension Resets & Base Styles
 */

html,
body {
    &.body--neutral {
        background: vars.$color--white;
    }
}

h1,
h2,
h3,
h4,
h5,
h5,
p,
div {
    font-size: vars.$font__size--default;
    margin: 0;
    padding: 0;

    &.menu-title {
        font-weight: bold;
        padding: 14px 0;

        &.fire-title {
            padding-top: 0px;
        }
    }
}

section,
ul,
ol,
li {
    margin: 0;
    padding: 0;
    position: relative;

    &.divider-bottom {
        border-bottom: 1px solid vars.$platinum;

        // Handle space between the last element in the container and the divider
        > :last-child {
            padding-bottom: 0;
            margin-bottom: 16px;
        }
    }
}

form,
input,
select,
option,
button {
    outline: none;

    * {
        outline: none;
    }
}

button {
    border: none;
    background-color: vars.$white;
    padding: 0;
}

/* Fonts */
body,
input,
textarea,
select {
    font-family: vars.$font__face--default;
    font-size: vars.$font__size--default;
    font-weight: normal;
    color: vars.$slate;
}

.bold {
    font-weight: bold;
}

/* Links */
a {
    color: vars.$blue;
    text-decoration: none;

    &:hover {
        text-decoration: underline;
    }

    &.link-secondary {
        color: vars.$slate;
    }
}

/**
 * DDG Extension Helper Classes
 */

/* Hide element */
.is-hidden {
    display: none;
}

/* Position */
.pull-right {
    position: absolute;
    right: 20px;
}

.pull-left {
    position: absolute;
    left: 20px;
}

/* Display */
.block {
    display: block;
}

/* Floats */
.float-left {
    float: left;
}

.float-right {
    float: right;
}

.clearfix {
    clear: both;
    height: 0;
    line-height: 0;
}

/* Text Centering */
.text--center {
    text-align: center;
}

.text--left {
    text-align: left;
}

/* Borders */
.border--top {
    border-top: vars.$card__border;
}

.border--bottom {
    border-bottom: vars.$card__border;
}

.border--bottom--inner {
    position: relative;

    &:after {
        content: '';
        border-bottom: vars.$card__border;
        position: absolute;
        bottom: 0;
        left: 20px;
        right: 20px;
    }
}

.border--top--inner {
    position: relative;

    &:before {
        content: '';
        border-top: vars.$card__border;
        position: absolute;
        top: 0;
        left: 20px;
        right: 20px;
    }
}

/* Padding */
.padded {
    padding: vars.$card--padded;
}

.padded--top {
    padding: vars.$card--padded--top;
}

.padded--top-half {
    padding-top: 8px;
}

.padded--bottom-half {
    padding-bottom: 8px;
}

.padded--no-bottom-padding {
    padding-bottom: 0;
}

/* Background */
.silver-bg {
    background-color: vars.$color--silver;

    .border--top,
    .border--bottom {
        border-color: #d8d8d8;
    }
}

.warning_bg {
    background-color: vars.$color--yellow;
}

/* Icons */
/* Standard icon display within the extension */
.icon {
    @include mixins.icon_display();
    /* you'll need to set the background image within each instance of .icon */

    &.icon__close {
        width: 14px;
        height: 14px;

        @include mixins.cross_platform_bg_image('close.svg');
    }

    &.icon__arrow {
        width: 12px;
        height: 12px;

        @include mixins.cross_platform_bg_image('arrow@2x.png');

        &.icon__arrow--left {
            transform: rotate(180deg);
        }

        &.icon__arrow--large {
            width: 7px;
            margin-top: -20px;
            @include mixins.cross_platform_bg_image('arrow--large.svg');
        }
    }

    &.icon__settings {
        width: 16px;
        height: 16px;

        @include mixins.cross_platform_bg_image('settings-gear@2x.png');
    }

    &.icon__error {
        width: 24px;
        height: 24px;
        vertical-align: bottom;
        margin-left: -2px;

        @include mixins.cross_platform_bg_image('error.svg');
    }

    &.icon__check {
        width: 22px;
        height: 22px;
        margin-top: -2px;
        margin-left: 1px;
        vertical-align: top;

        @include mixins.cross_platform_bg_image('check.svg');
    }

    &.icon__shield {
        width: 22px;
        height: 22px;
        margin-top: -3px;
        margin-left: 1px;
        vertical-align: top;

        @include mixins.cross_platform_bg_image('shield.svg');
    }
}

/* Popover
 * Template is in templates/shread/popover.js
 * Sample usage:
 *    .site-info__li--trackers {
 *        position: relative;
 *
 *        &:hover {
 *            .popover.site_info__trackers__popover {
 *                display: block;
 *                top: initial;
 *                bottom: 45px;
 *            }
 *        }
 */

/* Popout box with left arrow */
.modal-box {
    .modal-box__body {
        width: 120px;
        height: 32px;
        border-radius: 4px;
        line-height: 1.5;
        text-align: center;
        padding-top: 5px;
        margin-left: 7px;
        background-color: vars.$white;
        border: solid 1px #ddd;
        color: vars.$slate;
        text-align: center;
        z-index: 1;
        float: right;
    }

    .modal-box__popout {
        @include mixins.arrow-left(7px, vars.$platinum);

        margin-right: -15px;
        margin-top: 13px;
        z-index: 3;
        float: left;
        position: absolute;
    }

    .modal-box__popout__body {
        @include mixins.arrow-left(6px, vars.$white);

        margin-left: 2px;
        margin-top: -6px;
        z-index: 5;
    }
}
